library(MASS)
library(ggplot2)
library(SupportVectorLab)

set.seed(100)
n <- 20
X1 <- cbind((1:20), -(1:20))
X2 <- cbind((21:40), -(1:20))
X <- rbind(X1, X2)
Xno1 <- mvrnorm(5, mu = c(-4,-8), Sigma = diag(1, nrow = 2))
yno1 <- rep(2, 5)

Xno2 <- mvrnorm(5, mu = c(30, 0), Sigma = diag(1, nrow = 2))
yno2 <- rep(1, 5)

y <- rep(c(2, 1), c(n, n))

X <- rbind(X, Xno1, Xno2)
y <- c(y, yno1, yno2)

s <- Sys.time()
model1 <- bsh_mctsvm(X, y, C1 = 1, C2 = 1,
                     lambda1 = 20, lambda2 = 20,
                     max.steps = 8000, kernel = "linear",
                     eps = 0)
e <- Sys.time()
print(e - s)
plot(model1)

s <- Sys.time()
model2 <- manysvms::sh_tsvm(X, y, C1 = 1, C2 = 1,
                            max.steps = 8000, kernel = "linear",
                            eps = 0)
e <- Sys.time()
print(e - s)
# plot(model2)

model1$coef1
model2$coef1


# 
# s <- Sys.time()
# model3 <- manysvms::bq_svm(X, y, C = 1, lambda = 80, tau = 0,
#                             max.steps = 8000, kernel = "linear",
#                            cccp.steps = 20, eps.cccp = 0)
# e <- Sys.time()
# print(e - s)
# plot(model3)
